1.8.1 Public Key Infrastructure (PKI)
Usage RSA Keys
            Usage keys consist of two RSA key pairs--one RSA key pair is generated and used for encryption and one RSA key pair is generated and used for signatures. With usage keys, each key is not unnecessarily exposed.
(Without usage keys, one key is used for both authentication methods, increasing the exposure of that key.)
General-Purpose RSA Keys
            General-purpose keys consist of only one RSA key pair that used for both encryption and signatures. General-purpose key pairs are used more frequently than usage key pairs

  
There are 3 types of Certificates:
  1. Root Certificate
There are 2 methods of Deployment
Responsibility of CA

pkifullconfig.pdf

Configuration Steps on IOS:

IN CA Server
  1. Synchronize the clocks (NTP - You could also use manual time set)
    • (config)# clock set 13:51:00 28 January 2013  // Manual - You could also use NTP
  2. Enable HTTP
    • (config)#ip http server
  3. Generate RSA key pair
    • (config)#crypto key generate rsa modulus 1024
  4. CA Server configuration
    • (config)#crypto pki server IOS_CA
      • (cs-server)# issuer_name CN=cisco_ca OU=Cisco L=Bangalore S=Karnataka C=India
      • (cs-server)# lifetime ca_certificate 3
      • (cs-server)# lifetime certificate 2
      • (cs-server)# grant auto
      • (cs-server)# database level minimum [DEFAULT]
      • (cs-server)# database URL flash: [DEFAULT: nvram]
      • (cs-server)# no shutdown  // It will ask for a password to initialize the server
        • Password: <_____________>
IN Client
  1. Define a trust point in the client
    • (config)# crypto pki trustpoint IOSCA  // OR you can use:  (config)# crypto ca trustpoint IOSCA
      • (ca-trustpoint)# enrollment url  http://10.1.1.1
      • (ca-trustpoint)# revocation check none
  2. Authenticate the CA
    • (config)# crypto pki authenticate IOSCA  
  3. Enroll
    • (config)# crypto pki enroll IOSCA
      • Password: <__________>
      • Confirim-Password: <______>
      • Include Router Serial in Subject: Y/N
      • Include IP in Subject:  Y/N
      • Enter Interface IP:  
      • Request Certificate from CA:  Y/N
Network Time Protocol (NTP)
  • It works on UDP 123
  • It supports authentication using MD5
  • It was derived from algorithm called Marzerllo  
  • It uses Stratum Number <1-15>: Logical Distance towards your NTP server
Configuration on Server:
  • (config)# ntp master <stratum number>
    • NTP learns the time by syncing with its internal software clock at the address 127.127.7.1 loopback
  • (config)# ntp authentication-key 1 md5 cisco
  • (config)# ntp trust-key 1
  • (config)# ntp authenticate  // To enable Authentication
Configuration on Client:
  • (config)# ntp server 10.1.1.1
  • (config)# ntp authentication-key 1 md5 cisco
  • (config)# ntp trust-key 1
  • (config)# ntp authenticate

  
  IOS L2L using CA

  

R1: NTP+CA server                                                                                                                                                                                                                        //NTP optional

clock set HH:MM:SS day month year

clock timezone IST 5 30                                                                                                                                                                  //optional

ntp master 1                                                                                                                                                                                                        //NTP STRATUM no. lower number will be preferred

ntp authenticate                                                                                                                                                                                          //optional for security

ntp trusted-key 1

ntp authentication-key 1 md5 cisco

!

ip domain-name cisco.com

!

crypto key generate rsa modulus 1024                                                                                                          //to generate private KEY

!

crypto pki server IOSCA                                                                                                                                                      //pki - public key infrastructure

issuer-name CN=IOSCA.cisco.com L=Bangalore C=India                                      //x.509 format

grant auto                                                                                                                                                                                                    //if client request server provides cert automatically

lifetime certificate 2                                                                                                                                                                //validity for client certificates

lifetime ca-certificate 1                                                                                                                                                    //validity for self-signed server certificates

cdp-url  http://10.1.1.1                                                                                                                                                      //ip address for client to request

database url flash://                                                                                                                                                              //to store certificates

no shutdown                                                                                                                                                                                      //to activate pki server

Password:cisco123

Re-enter password: cisco123

% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

% Exporting Certificate Server signing certificate and keys...

% Certificate Server enabled.

ip http server

Dec    2 10:42:03.895: %PKI-6-CS_ENABLED: Certificate server now enabled.

  

Verification:

show ntp status

  

In R2:

clock timezone IST 5 30

ntp trusted-key 1

ntp authentication-key 1 md5 cisco

ntp server 10.1.1.1

!

ip domain-name cisco.com

!

crypto key generate rsa modulus 1024

The name for the keys will be: IPsecPeer1.cisco.com

!

crypto pki trustpoint MyCA

enrollment url  http://10.1.1.1:80                                          //SCEP uses http to carry certificates

revocation-check crl none or  http://.......

!

  

crypto pki authenticate MyCA

% Do you accept this certificate? [yes/no]: yes

Trustpoint CA certificate accepted.

!

crypto pki enroll MyCA

Password:ciscoabc

Re-enter password: ciscoabc

  

% The subject name in the certificate will include: IPsecPeer1.cisco.com

% Include the router serial number in the subject name? [yes/no]:  no

% Include an IP address in the subject name? [no]:  no

Request certificate from CA? [yes/no]:  yes

  

In R3

clock timezone IST 5 30

ntp trusted-key 1

ntp authentication-key 1 md5 cisco

ntp server 10.1.1.1

!

ip domain-name cisco.com

!

crypto key generate rsa modulus 1024

The name for the keys will be: IPsecPeer1.cisco.com

!

crypto pki trustpoint MyCA

enrollment url  http://10.1.1.1:80                                          //SCEP uses http to carry certificates

revocation-check crl none or  http://.......

!

crypto pki authenticate MyCA

% Do you accept this certificate? [yes/no]: yes

Trustpoint CA certificate accepted.

!

crypto pki enroll MyCA

Password:ciscoabc

Re-enter password: ciscoabc

  

% The subject name in the certificate will include: IPsecPeer1.cisco.com

% Include the router serial number in the subject name? [yes/no]:  no

% Include an IP address in the subject name? [no]:  no

Request certificate from CA? [yes/no]:  yes

  

Verification:

sh ntp status

Show ntp association

sh cry pki certificates

  

R1:

crypto isakmp policy 10

Authentication rsa-sig

hash md5

group 2

!

crypto ipsec transform-set TSET esp-des esp-md5-hmac

!

crypto map CMAP 10 ipsec-isakmp

set peer 10.1.1.3

set transform-set TSET

match address 101

!

access-list 101 permit ip 1.0.0.0 0.0.0.255 2.0.0.0 0.0.0.255

!

Inter f0/0

crypto map CMAP

  

R2:

crypto isakmp policy 20

Authentication rsa-sig

hash md5

group 2

!

crypto ipsec transform-set TSET esp-des esp-md5-hmac

!

crypto map CMAP 10 ipsec-isakmp

set peer 10.1.1.2

set transform-set TSET

match address 101

!

access-list 101 permit ip 2.0.0.0 0.0.0.255 1.0.0.0 0.0.0.255

!

Inter f0/0

crypto map CMAP

  

Verification:

Show crypto isakmp sa

Show crypto isakmp sa detail

Show crypto ipsec sa


Home Work Task:

First let us synchronize the clock using NTP

At the NTP Server:
From Privilege Mode
From Config Mode

At the CA_Server, R2 and R3:

From Config Mode
PLEASE NOTE: CA_Server and R2 will successfully synchronize the clock. R3 will not because ASA is blocking UDP 123 (NTP). It can be solved by:

At ASA:
From Config Mode
At this point our NTP syncing should be done. Now let us configure the CA Server and Client.

Configuration of PKI

At CA_Server:
Firstly, configure it to be an HTTP Server
Then let us configure crypto:
At this point, it will ask for a password. Provide a password!

At R2 and R3:
PLEASE NOTE: At this point, R2 will receive certificate (Due to HTTP being inspected) but R3 will not get since the ASA will block http traffic. This can be overcome by:

At ASA:
Add to the existing access-list,
At this point all certificate issuing will be complete.

VPN Configuration:

At R2 and R3
We have configured the VPNs, but since the ESP (50) and UDP (500) are being blocked by ASA, we need to make the changes as follows:
At ASA using the existing access-list:

WIRESHARK CAPTURED PACKETS

IPSec Using RSA & CA.pcapng